﻿@model Orchard.ContentFields.ViewModels.EditHtmlFieldViewModel
@using Orchard.ContentManagement.Metadata.Models
@using Orchard.ContentFields.Settings;

@{
    var settings = Model.PartFieldDefinition.Settings.ToObject<HtmlFieldSettings>();
}

<script name="trumbowyg" depends-on="admin" asp-src="/Orchard.Resources/Scripts/trumbowyg.min.js" debug-src="/Orchard.Resources/Scripts/trumbowyg.js" at="Foot"></script>
<style name="trumbowyg" asp-src="/Orchard.Resources/Styles/trumbowyg.min.css" debug-src="/Orchard.Resources/Styles/trumbowyg.css"></style>

<fieldset class="form-group">
    <label asp-for="Html">@Model.PartFieldDefinition.DisplayName()</label>
    <textarea asp-for="Html" class="form-control"></textarea>
    @if (!String.IsNullOrEmpty(settings.Hint))
    {
        <span class="hint">@settings.Hint</span>
    }
</fieldset>

<script at="Foot">
    $(function () {
        $('#@Html.IdFor(m => m.Html)').trumbowyg();
    });
</script>